package org.test.netty;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 使用CommandLineRunner或ApplicationRunner 命令启动服务器
 * 此操作在springboot启动时执行
 * 多个操作需要用@Order注解进行排序
 *
 */
@Component
public class RunServer implements CommandLineRunner  {
 
	@Value("${server.httpport}")
	private int httpport;
	  
	@Override
	public void run(String... args) throws Exception {
	 new Thread(new NettyWebSocketServer(httpport)).start();
	}

	
	
	public int getHttpport() {
		return httpport;
	}

	public void setHttpport(int httpport) {
		this.httpport = httpport;
	}
}
